package com.yh.patterns.prototype.test;

/**
 * @Auther:云尚学Java
 */
public class Client {
    public static void main(String[] args) throws Exception {
        /**
         * 浅克隆
         */
        /*//1.创建原型对象
        Citation citation=new Citation();
        //2.克隆奖状对象
        Citation clone = citation.clone();
        //3.给奖状写名字
        citation.setName("云尚");
        clone.setName("四维");
        //调用show方法展示
        citation.show();
        clone.show();*/

        /**
         * 浅克隆存在的问题
         */
        Citation citation=new Citation();
        Student student=new Student();
        student.setName("云尚");
        citation.setStudent(student);
        Citation clone = citation.clone();
        clone.getStudent().setName("四维");
        citation.show();
        clone.show();
    }
}
